import java.util.Deque;
import java.util.LinkedList;

public class offer09 {
    Deque<Integer> stack1 = new LinkedList();
    Deque<Integer> stack2 = new LinkedList();
    public void appendTail(int value) {
        if(stack1.isEmpty()){
            stack1.offer(value);
        }else{
            while (!stack1.isEmpty()){
                stack2.push(stack1.pop());
            }
            stack1.push(value);
            while (!stack2.isEmpty()){
                stack1.push(stack2.pop());
            }
        }
    }
    public int deleteHead() {
        if(stack1.isEmpty()){
            return -1;
        }
        return stack1.pop();
    }
}
